
Technotes
ChangedResource: Too much of a good thing.
Written by: Dave Burnard April 1988
The toolbox trap ChangedResource is used to inform the Resource
Manager that the contents of a resource have changed and should be written to
disk. The actual write occurs on the next call to WriteResource (for
the specific resource) or UpdateResFile (for the resource file
containing the specified resource). When called, ChangedResource
reserves enough disk space to contain the changed resource. A little-known
"feature" of ChangedResource is that it reserves disk space every time
it is called. Thus if you call ChangedResource ten times on a large
resource before the resource is actually written out, you may unexpectedly run
out of disk space since ten times the amount of disk space actually needed will
be reserved.
If your program frequently changes the contents of resources, especially large
ones, then you should call WriteResource or UpdateResFile
immediately after calling ChangedResource. Once the resource is
actually written, the file's EOF will be set correctly, and the first
subsequent call to ChangedResource will work correctly.
Further Reference:
Tech Support
Technotes
Previous Technote | Contents | Next Technote

Main |
Page One |
What's New |
Apple Computer, Inc. |
Find It |
Contact Us |
Help